package com.cskaoyan.bean.vo.vxVo;

import com.cskaoyan.bean.po.wxPo.MarketGoods;
import com.cskaoyan.util.StringToArrayUtils;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
public class WxGoodsInfoVO {
    private Integer id;

    private String goodsSn;

    private String name;

    private Integer categoryId;

    private Integer brandId;

    private List<String> gallery;

    private String keywords;

    private String brief;

    private Boolean isOnSale;

    private Short sortOrder;

    private String picUrl;

    private String shareUrl;

    private Boolean isNew;

    private Boolean isHot;

    private String unit;

    private BigDecimal counterPrice;

    private BigDecimal retailPrice;

    private Date addTime;

    private Date updateTime;

    private Boolean deleted;

    private String detail;

    public static WxGoodsInfoVO getWxGoodsInfoVO(MarketGoods marketGoods){
        WxGoodsInfoVO wxGoodsInfoVO = new WxGoodsInfoVO();
        wxGoodsInfoVO.setId(marketGoods.getId());
        wxGoodsInfoVO.setGoodsSn(marketGoods.getGoodsSn());
        wxGoodsInfoVO.setName(marketGoods.getName());
        wxGoodsInfoVO.setCategoryId(marketGoods.getCategoryId());
        wxGoodsInfoVO.setBrandId(marketGoods.getBrandId());
        String gallery = marketGoods.getGallery();
        List<String> stringList = StringToArrayUtils.toStringList(gallery);
        wxGoodsInfoVO.setGallery(stringList);
        wxGoodsInfoVO.setBrief(marketGoods.getBrief());
        wxGoodsInfoVO.setIsOnSale(marketGoods.getIsOnSale());
        wxGoodsInfoVO.setSortOrder(marketGoods.getSortOrder());
        wxGoodsInfoVO.setPicUrl(marketGoods.getPicUrl());
        wxGoodsInfoVO.setShareUrl(marketGoods.getShareUrl());
        wxGoodsInfoVO.setIsNew(marketGoods.getIsNew());
        wxGoodsInfoVO.setIsHot(marketGoods.getIsHot());
        wxGoodsInfoVO.setUnit(marketGoods.getUnit());
        wxGoodsInfoVO.setCounterPrice(marketGoods.getCounterPrice());
        wxGoodsInfoVO.setRetailPrice(marketGoods.getRetailPrice());
        wxGoodsInfoVO.setAddTime(marketGoods.getAddTime());
        wxGoodsInfoVO.setUpdateTime(marketGoods.getUpdateTime());
        wxGoodsInfoVO.setDeleted(marketGoods.getDeleted());
        wxGoodsInfoVO.setDetail(marketGoods.getDetail());
        return wxGoodsInfoVO;
    }
}
